<?php
Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . "/js/dist/js/jquery.bootstrap-duallistbox.js");
Yii::app()->clientScript->registerCssFile(Yii::app()->baseUrl . "/css/dist/css/bootstrap-duallistbox.css");

$this->breadcrumbs = array(
    '分类管理' => array('/manage/series/manage'),
    '关联主题'
);
?>
<div class="row" style="min-height:300px;background-color:#fff;">
    <?php

    $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
        'id' => 'CreateForm',
        'action' => 'link?id=' . $model->id,
        'type' => 'horizontal',
        'enableAjaxValidation' => false,
        'enableClientValidation' => true,
        'clientOptions' => array(
            'validateOnSubmit' => true,
        ),
    ));

    if ($form instanceof TbActiveForm) {

    }

    ?>
    <blockquote><b>关联主题</b></blockquote>
    <div class="col-md-12">
        <?php
        echo $form->hiddenField($model, 'id');
        ?>
    </div>
    <div class="col-md-12">
        <?=
        CHtml::activeDropDownList($model, 'tids', Topic::getOptions('topics'),
            ['id' => 'linktids', 'multiple' => true, 'data-select' => 'dual']);            //$form->field($model,
        ?>
    </div>
    <div class="col-md-12">
        <?php
        $this->widget('bootstrap.widgets.TbButton', array(
            'buttonType' => 'submit',
            'type' => 'primary',
            'label' => '关联',
            'htmlOptions' => array('class' => 'submit', 'style' => 'width:120px;margin:15px 400px;'),
        ));
        ?>
    </div>


    <?php
    $this->endWidget();
    ?>
</div>
<script>
    $("#linktids").bootstrapDualListbox({
        nonSelectedListLabel: '可选择主题',
        selectedListLabel: '已经选择主题',
        preserveSelectionOnMove: 'moved',
        sortByInputOrder: true
    });

</script>